##9-11 导入Admin类：以为完成练习9-8而做的工作为基础，将User、Privileges和Admin类存储在一个模块中，
##再创建一个文件，在其中创建一个Admin实例并对其调用方法show_privileges()，以确认一切都能正确地运行。
class User:
    def __init__(self,first_name,last_name, age, email, location, login_attempts=1):
        self.first_name = first_name
        self.last_name = last_name
        self.age = age
        self.email = email
        self.location = location
        self.login_attempts = login_attempts
    
    def describe_user(self):
        print('姓名:', self.first_name.title(),' ',self.last_name.title())
        print('年龄:', self.age)
        print('邮箱:', self.email)
        print('所在地:', self.location)
        
    def greet_user(self):
        full_name = self.first_name.title() + ' ' + self.last_name.title()
        print('欢迎回来: ',full_name)

    def increment_login_attempts(self):
        self.login_attempts += 1

    def reset_login_attempts(self):
        self.login_attempts = 0



from user import *
from privileges import *

class Admin(User):
    def __init__(self,first_name,last_name, age, email, location, privileges, login_attempts=1):
        super().__init__(first_name,last_name, age, email, location,login_attempts)
        self.privileges = Privileges(privileges)

class Privileges:
    def __init__(self,privileges):
        self.privileges = privileges

    def show_privileges(self):
        print("管理员权限：")
        for s in self.privileges:
            print(' -', s)


pri = ['can remove','can ban'];
ad = Admin('Elon','Musk',43,'x@gmail.com','DX', pri)
ad.privileges.show_privileges();

